package com.sh.common;

public class ReturnVO {
	private int count;		//总数量，分页的时候用到

	private String code;		//服务器 code
	private String serviceCode;	//系统服务编码
	private String message;
	private Object data;


	public ReturnVO(String code,
					String serviceCode,
					String message,
					Object data,
					int count) {
		super();
		this.code = code;
		this.serviceCode = serviceCode;
		this.message = message;
		this.data = data;
		this.count = count;
	}
	/**
	 * 成功返回查询 数据 有分页的情况
	 * */
	public static ReturnVO succForPage(String serviceCode,String msg,Object data,int count) {
		ReturnVO r = new ReturnVO("200",serviceCode,msg,data,count);
		return r;
	}


	/**
	 * 返回成功的业务信息数据
	 * */
	public static ReturnVO succForService(String serviceCode,String msg,Object data) {
		ReturnVO r = new ReturnVO("200",serviceCode,msg,data,0);
		return r;
	}
	/**
	 * 返回成功的数据
	 * */
	public static ReturnVO succ(Object data) {
		ReturnVO r = new ReturnVO("200","","操作成功",data,0);
		return r;
	}
	/**
	 * 返回失败 业务信息信息
	 * */
	public static ReturnVO failForService(String code,String serviceCode,String msg) {
		ReturnVO r = new ReturnVO(code,serviceCode,msg,null,0);
		return r;
	}
	/**
	 * 返回失败 信息
	 * */
	public static ReturnVO fail() {
		ReturnVO r = new ReturnVO("400","","操作失败",null,0);
		return r;
	}


	/**
	 * @return the count
	 */
	public int getCount() {
		return count;
	}


	/**
	 * @param count the count to set
	 */
	public void setCount(int count) {
		this.count = count;
	}


	/**
	 * @return the code
	 */
	public String getCode() {
		return code;
	}
	/**
	 * @param code the code to set
	 */
	public void setCode(String code) {
		this.code = code;
	}
	/**
	 * @return the message
	 */
	public String getMessage() {
		return message;
	}
	/**
	 * @param message the message to set
	 */
	public void setMessage(String message) {
		this.message = message;
	}
	/**
	 * @return the data
	 */
	public Object getData() {
		return data;
	}
	/**
	 * @param data the data to set
	 */
	public void setData(Object data) {
		this.data = data;
	}

	/**
	 * @return the serviceCode
	 */
	public String getServiceCode() {
		return serviceCode;
	}

	/**
	 * @param serviceCode the serviceCode to set
	 */
	public void setServiceCode(String serviceCode) {
		this.serviceCode = serviceCode;
	}


}
